 
 <%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
 <%@page import="java.util.List"%>
 <%@page import="shoppingmall.jmu.order.dao.OrderDAO"%>
<%@page import="shoppingmall.jmu.order.entity.Order"%>
<%@page import="shoppingmall.jmu.order.dao.impl.OrderDAOImpl"%>
<%@page import="shoppingmall.jmu.address.dao.AddressDAO"%>
<%@page import="shoppingmall.jmu.address.entity.Address"%>
<%@page import="shoppingmall.jmu.address.dao.impl.AddressDAOImpl"%>
<%@page import="shoppingmall.jmu.orderitem.dao.OrderItemDAO"%>
<%@page import="shoppingmall.jmu.orderitem.entity.OrderItem"%>
<%@page import="shoppingmall.jmu.orderitem.dao.impl.OrderItemDAOImpl"%>
<%@page import="shoppingmall.jmu.good.dao.GoodsDAO"%>
<%@page import="shoppingmall.jmu.good.entity.Goods"%>
<%@page import="shoppingmall.jmu.good.dao.impl.GoodsDAOImpl"%>

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>订单打印</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- page style-->
  <style>
  .my_itemtitle{
    font-size: 20px;
  }
  .my_info{
    width: 50% !important;
  }
  </style>
  <!-- Bootstrap 3.3.7 -->
  <link rel="stylesheet" href="../css/bootstrap/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="../css/font-awesome/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="../css/Ionicons/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="../css/AdminLTE/AdminLTE.min.css">
  <!-- Google Font -->
  <!-- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic"> -->
</head>
<body onload="window.print();">
  <div class="wrapper">
    <!-- Main content -->
    <section class="invoice">
      <!-- title row -->
      <div class="row">
        <div class="col-xs-12">
          <h2 class="page-header">
            <i class="fa"></i>订单详情
            <small class="pull-right">日期: 2019-8-3</small>
          </h2>
        </div>
        <!-- /.col -->
      </div>
      <!-- info row -->
      
      <% 
      OrderDAO dao = new OrderDAOImpl();
      AddressDAO dao1 = new AddressDAOImpl();
      String address_id = request.getParameter("address_id");
      int address_id1 = Integer.parseInt(address_id);
      
      String user_id = request.getParameter("user_id");
      
      List<Address> address= dao1.getAllAddressByUserId(user_id);
      
      address_id1--;
      
      Address a = address.get(address_id1);
      
      %>
      
      <div class="row invoice-info">
        <div class="col-sm-4 invoice-col my_info">
            <b class="my_itemtitle">收件人</b><br>
            <br>
            <b>姓名：</b><%=a.getReceiver() %><br>
            <b>地址：</b><%=a.getAddress() %><br>
            <b>电话：</b><%=a.getReceiver_phone() %><br>
        </div>
        <!-- /.col -->
        
        <%
        String order_id = request.getParameter("order_id");
        Order o = dao.getOrderByOrderId(order_id);
        
        %> 
        <div class="col-sm-4 invoice-col my_info">
          <b class="my_itemtitle">订单编号：<%=o.getOrder_id() %></b><br>
          <br>
          <b>创建时间：<%=o.getPlaced() %></b><br>
          <b>订单总额：<%=o.getPayment() %></b><br>
          <b>订单状态：</b><%=o.getSta() %>
        </div>
        <!-- /.col -->
      </div>
      <hr>
      <!-- /.row -->
      <!-- Table row -->
      <div class="row">
        <div class="col-xs-12 table-responsive">
          <table class="table table-striped">
            <thead>
            <tr>
              <th>数量</th>
              <th>名称</th>
              <th>商品编号</th>
              <th>商品描述</th>
              <th>单价</th>
            </tr>
            </thead>
            <tbody>
            <%
       OrderItemDAO dao2 = new OrderItemDAOImpl();	
       List<OrderItem> Orderi =dao2.getOrderItemByOrderId(order_id);
       
       GoodsDAO dao3 = new GoodsDAOImpl();
       for(int i=0;i<Orderi.size();i++){
    	   Goods g = dao3.getGoodsByID(Orderi.get(i).getProduct()); 
       %>
       
            <tr>
              <td><%=Orderi.get(i).getCount() %></td>
              <td><%=g.getTitle() %></td>
              <td><%=g.getIsbn() %></td>
              <td><%=g.getAuthor() %></td>
              <td>￥<%=(float)g.getPrice() %></td>
            </tr>
           <%} %>
            </tbody>
          </table>
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->
  </div>
  <!-- ./wrapper -->
</body>
</html>
